#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int n,a,b,c;
	scanf("%d",&n);
	c = n % 10;
	b = n / 10 % 10;
	a = n / 100;
	if (a == b && b == c)
		printf("0");
	else
	{
		int temp;
		if (a > b)
		{
			temp = b;
			b = a;
			a = temp;
		}
		if (a > c)
		{
			temp = c;
			c = a;
			a = temp;
		}
		if (b > c)
		{
			temp = c;
			c = b;
			b = temp;
		}
		
			
		
	}
	return 0;
}